package com.hx.vending.controller;

import com.hx.vending.annotation.Authorization;
import com.hx.vending.annotation.CurrentUserId;
import com.hx.vending.service.ICapitalFlowService;
import com.hx.vending.util.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2018/11/28.
 * 流水
 */
@Controller
@RequestMapping("/capitalFlow")
public class CapitalFlowController {


    @Autowired
    private ICapitalFlowService iCapitalFlowService;

    /**
     * 查询余额明细
     * @param userId 用户id
     * @param startTime
     * @param stopTime
     * @param pageNum
     * @param pageSize
     * @param type  0微信 1支付宝
     * @return
     */
    @PostMapping("/selectCapitalFlowByTime")
    @ResponseBody
    @Authorization
    public Msg selectCapitalFlowByTime(@CurrentUserId Integer userId,Integer type, String startTime, String stopTime,
                                       @RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
                                       @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize) {
        return this.iCapitalFlowService.selectCapitalFlowByTime(userId,type, startTime, stopTime, pageNum, pageSize);
    }


}
